package
{
	import away3d.primitives.Cube;
	
	import com.wemakedotcoms.away3D.BasicHover3DScene;
	
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageQuality;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.TimerEvent;
	
	[SWF(backgroundColor="#FFFFFF", frameRate="30", quality="LOW", width="800", height="600")]
	
	public class BasicHover3DSceneDemo extends Sprite
	{
		// our basic Scene
		private var basicHover3DScene:BasicHover3DScene;
		
		// Something to look at
		private var cube:Cube
		
		public function BasicHover3DSceneDemo()
		{
			super();
			
			// once added to the stage init the app
			addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler, false, 0, true);
			
		}
		
		
		private function addedToStageHandler(event:Event):void
		{
			// Init stage
			stage.quality = StageQuality.HIGH;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			stage.stageFocusRect = false;
			
			// create our basic scene
			basicHover3DScene = new BasicHover3DScene();
			
			// add the basic 3D scene to the display list
			addChild(basicHover3DScene);
			
			// add a cube
			cube = new Cube();
			basicHover3DScene.add3DObject(cube);
			
			basicHover3DScene.renderTimer.addEventListener(TimerEvent.TIMER, renderTimerHandler, false, 0, true);
		}
		
		private function renderTimerHandler(e:TimerEvent):void
		{
			// rotate the cube around the y axis
			cube.yaw(-1);
		}
	}
}